﻿<html>
<head>
    <script src="/js/validate.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="background-color: transparent">
<form id="id-form" name="frm" method="post" action="/globalconfig/productcategory/save" enctype="multipart/form-data">
	<input type="hidden" name="PRICEID" id="PRICEID" value="<?=(isset($this->data)?$this->data->PRICEID:'')?>" />
	<table>
        <tr>
        	<td class="popup-label">
				Mininum
        	</td>
        	<td >
				<input class="popup-input" id="MINDAYNUMBER" name="MINDAYNUMBER" value="<?=(isset($this->data)?$this->data->MINDAYNUMBER:'')?>" type="text"  size="3"/>
        	</td >
            <td class="popup-label">
				Maximum
        	</td>
        	<td>
				<input class="popup-input" id="MAXDAYNUMBER" name="MAXDAYNUMBER" value="<?=(isset($this->data)?$this->data->MAXDAYNUMBER:'')?>" type="text"  size="3"/>
        	</td>
			<td class="popup-label">Price per day</td>        	
			<!--Start of combobox-->
			<td class="popup-label">
				<input class="popup-input" id="PRICE" name="PRICE" value="<?=(isset($this->data)?$this->data->PRICE:'')?>" type="text"  size="15"/>
        	</td> 
        </tr>
        
		<br/>
   	</table>    
</form>
<script language="text/javascript">
    function save(){
		$('#add-price-dialog').dialog('close');
		var min = $('#MINDAYNUMBER').val();
		var max = $('#MAXDAYNUMBER').val();
		var price = $('#PRICE').val();
		var id = $('#PRICEID').val();
		$.ajax({
			url: "/admin/price/save",
			type: "POST",
			data: {MINDAYNUMBER: min, MAXDAYNUMBER: max, PRICEID: id, PRICE: price},
			dataType: "text",
			success: function(result) {
				var text = $.trim(result);
				if(text.indexOf('<td>') >=0 ){
					if(id == ""){
						$('#product-table tbody').append(text);
						$('#no-data').fadeOut();
						$('#no-data').remove();
					} else {
						$('#row' + id).html(text);
					}
				} else {
					alert("You have an error: " + text);
				}
			}
		});
    }	
</script>
</body>
</html>